<template>
	<view class="content">
		<!-- <u-upload :custom-btn="true" max-count="1" :action=action>
			<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
				<u-icon name="plus" size="60" :color="$u.color['lightColor']"></u-icon>
			</view>
		</u-upload> -->
		<u-upload  :action="action" max-count="1"  :before-upload="beforeUpload" :file-list="lungFileList" @on-success="uploadFrontSuccess"></u-upload>
		<!-- <u-button @click="submit">提交</u-button> -->
		<view class=imgContent>
			<view>{{dataList.ocr_num}}</view>
			<view>{{dataList.ocr_price}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				action: 'http://123.56.48.97:5009/upload',
				// action:'http://192.168.11.2:5009/upload',
				filesArr: [],
				dataList:{}
			}
		},
		onLoad() {
		},
		methods: {
			// submit() {
			// 				this.$refs.uUpload.upload();
			// 			},
			async  beforeUpload(index,list){
				console.log("index,list",list)
				// const data = await  this.$u.post('url')
				// list[0].response
				// console.log("data",data)
			},
			// onSuccess(data){
			// 	console.log("Data",data)
			// },
			uploadFrontSuccess(data, index, lists, name) { 
			 this.dataList = data.data
			 console.log("Data",data)
			 }, 
			beforeAvatarUpload(file){
				uni.uploadFile({
					url:this.action,
					name:'fileName',
					filePath:file[0].url,
					success:(res)=>{
						console.log("res",res)
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.slot-btn {
		margin-top: 100rpx;
		width: 329rpx;
		height: 140rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: rgb(244, 245, 246);
		border-radius: 10rpx;
	}
	
	.slot-btn__hover {
		background-color: rgb(235, 236, 238);
	}
</style>
